const db = uniCloud.database();

exports.main = async (event, context) => {
  const { account, password } = event;

  // 查询数据库中的用户信息
  const user = await db.collection('user_info').where({
    account: account
  }).get();
  if (user.data.length === 0) {
    return { success: false, message: '账号不存在' };
  }

  const storedPassword = user.data[0].password;
  
  if (password === storedPassword) {
    return { success: true, message: '登录成功', user: user.data[0] };
  } else {
    return { success: false, message: '密码错误' };
  }
};
